package com.service.impl;


import java.util.HashMap;
import java.util.Map;

import net.sf.json.JSONObject;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bean.TravelUser;
import com.dao.TravelUserDao;
import com.service.TravelUserService;
import com.util.LoggerUtil;

@Component
public class TravelUserServiceImpl implements TravelUserService{
	public static Logger logger=Logger.getLogger(TravelUserServiceImpl.class);
	@Autowired
	private TravelUserDao travelUserDao;

	@Override
	public Map<String, Object> getTravelUserByWeiboid(String userId,JSONObject logs) {
		Map<String, Object> map=new HashMap<String, Object>();
		try {
			TravelUser  travelUser=travelUserDao.getTravelUserByWeiboid(userId);
			
			if(travelUser!=null){
				map.put("result", "success");
				map.put("rows", travelUser);
				LoggerUtil.backlogsSuccess(logs, logger);
			}else{
				map.put("result", "false");
				LoggerUtil.backlogsFalseNOData(logs, logger);
			}
		} catch (Exception e) {
			e.printStackTrace();
			map.put("code", "101");
			LoggerUtil.backlogsFalseError(logs, logger,e);
			return map;
		}
		return map;
	}
	
}
